<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title></title>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<script type="text/javascript">
  //编写自定义JS代码
  </script>
</head>
<body>
	<t:formvalid formid="formobj" dialog="true" layout="table" enctype="multipart/form-data" 
		action="labBranchController.do?doAdd" tiptype="3" beforeSubmit="doBeforeSubmit">
		<input id="id" name="id" type="hidden" value="${lab1.id }">
		<table cellpadding="0" cellspacing="1" class="formtable"> 
		
			<tr>
				<td align="right">
					<label class="Validform_label">分室编号: </label>
				</td>
				<td class="value"><input id="no" name="no" type="text"
					class="inputxt" datatype="*" maxlength="80" value="${lab1.no }"
					onkeypress="specialTextValidate()"> 
					<span class="Validform_checktip"></span>
				    <label class="Validform_label" 	style="display: none;">编号</label>
				</td>
				<td align="right"><label class="Validform_label">
						分室名称: </label>
				</td>
				<td class="value">
				    <input id="name" name="name" type="text" class="inputxt" datatype="*" maxlength="80" value="${lab1.name }"
					onkeypress="specialTextValidate()"> 
					<span class="Validform_checktip"></span> 
					<label class="Validform_label"	style="display: none;">名称</label>
				</td>
			</tr>
			
			<tr>
				<td align="right">
					<label class="Validform_label"> 所属院系: </label>
				</td>
				<td class="value">
					<t:CommonSelect url="dictCollegeController.do?select" value='${lab1.college.id }' name="collegeId" textField="text" idField="id"></t:CommonSelect>
					<span class="Validform_checktip"></span> 
					<label class="Validform_label"	style="display: none;"> 所属院系</label>
				</td>
				<td align="right">
					<label class="Validform_label"> 所属实验中心:</label>
				</td>
				<td class="value" colspan="3">
					<t:CommonSelect url="expCenterController.do?select" value='${lab1.expCenter.id }' 
						name="centerId" textField="name" idField="id"></t:CommonSelect> 
				</td> 
			</tr>
			
			<tr>
				<td align="right">
					<label class="Validform_label"> 所属实验室: </label>
				</td>
				<td class="value">
					<t:CommonSelect url="labController.do?common-select" value="${lab1.parentLab.id }"  name="parentLabId" textField="name" idField="id"></t:CommonSelect>
				</td>
				<td align="right">
					<label class="Validform_label"> 分室类型: </label>
				</td>
				<td class="value">
					<t:CommonSelect url="dictCenterTypeController.do?select" value="${lab1.type.id }"  name="typeId" textField="name" idField="id"></t:CommonSelect>
				</td>
			</tr>
			
			<tr>
				<td align="right">
					<label class="Validform_label">可容纳人数: </label>
				</td>
				<td class="value">
					<input id="holdeCount" name="holdeCount" type="text"
						class="inputxt" datatype="*" maxlength="5" value="${lab1.holdeCount }"
						onkeypress="numberValidate()"> 
					<span class="Validform_checktip"></span>
				    <label class="Validform_label" 	style="display: none;">可容纳人数</label>
				</td>
				<td align="right">
					<label class="Validform_label">	所属学科: </label>
				</td>
				<td class="value">
				  <t:CommonSelect url="dictSubjectController.do?select" value="${lab1.subject.id }" name="subjectId" textField="subjectName" idField="id"></t:CommonSelect>
					<span class="Validform_checktip"></span> 
					<label class="Validform_label"	style="display: none;">所属学科</label>					 
				</td>
			</tr>
			 
			<tr>
				<td align="right">
					<label class="Validform_label"> 建立时间: </label>
				</td>
				<td class="value">
					<input id="buildDate" name="buildDate" type="text" value='<fmt:formatDate value="${lab1.buildDate }" pattern="yyyy-MM-dd" />'
					class="inputxt" onkeypress="specialTextValidate()"> 
				</td> 
				<td align="right">
					<label class="Validform_label">分室级别: </label>
				</td>
				<td class="value">
					<t:CommonSelect url="dictLevelController.do?select" value="${lab1.level.id }" name="levelId" textField="levelName" idField="id"></t:CommonSelect>
					<span class="Validform_checktip"></span> 
					<label class="Validform_label"	style="display: none;">级别</label>
				</td>
				
			</tr>
			<tr>
				
				<td align="right"><label class="Validform_label">
						地址: </label>
				</td>
				<td class="value">
					<input id="address" name="address" type="text" value="${lab1.address }"
					class="inputxt"  maxlength="200" value="${lab1.address}" style='width:250px;'
					onkeypress="specialTextValidate()"> 
					 
				</td>
				<td align="right"><label class="Validform_label">
						使用面积（m<sup>2</sup>）: </label>
				</td>
				<td class="value">
					<input id="area" name="area" type="text" value="${lab1.area }"
					class="inputxt"  maxlength="80" > 					 
				</td>
			</tr> 
			<tr>
				<td align="right"><label class="Validform_label">
					行数: </label>
				</td>
				<td class="value">
					<input id="rowCount" name="rowCount" type="text" value="${lab1.rowCount }"
					class="inputxt"  maxlength="4" value="${lab1.address}" style='width:150px;'
					onkeypress="numberValidate()"> 
					 
				</td>
				<td align="right"><label class="Validform_label">
						列数: </label>
				</td>
				<td class="value">
					<input id="colCount" name="colCount" type="text" value="${lab1.colCount }"
					class="inputxt"  maxlength="4" onkeypress="numberValidate()">  					 
				</td>
			</tr>
			<tr>
				<td align="right">
					<label class="Validform_label">
						面向专业:
					</label>
				</td>
				<td class="value">
					<input id="majorId" name="majorId" type="hidden" value="${majorId }">               
				     <input id="majorName" type="text" style="width: 150px" class="inputxt" 
				      readonly="readonly" value="${majorName }">
				     <t:choose hiddenName="majorId" hiddenid="id" url="lessonInfoController.do?goMajorSelect" name="majorList"
                         icon="icon-search" title="选择" textname="majorName" inputTextname="majorName" isclear="false" isInit="true"></t:choose>
					<span class="Validform_checktip"></span>
					<label class="Validform_label" style="display: none;">面向专业</label>
				</td>
				<td align="right">
					<label class="Validform_label">
						价格:
					</label>
				</td>
				<td class="value">
					<input id="price" name="price" type="text" value='${lab1.price }'
					class="inputxt" onkeyup="this.value=this.value.match(/^\d*\.?\d{0,2}/)[0]"> 
					<span class="Validform_checktip"></span>
					<label class="Validform_label" style="display: none;">价格</label>
				</td>
			</tr>
			<tr>
				<td align="right"><label class="Validform_label">
					备注: </label>
				</td>
				<td class="value" colspan="3">
					<textarea rows="5" style="width: 100%;" maxlength="200" name="remark">${lab1.remark }</textarea>
				</td>
			</tr>  
		</table>
		<t:tabs id="tabs" width="880px" tabPosition="top" iframe="false" fit='false'>
			<t:tab title="分室图片" id="imgTab" href="labBranchController.do?imgTab&id=${lab1.id}"></t:tab>
			<t:tab title="工作人员" id="staffTab" href="labTabController.do?staffTab&centerId=${lab1.id}"></t:tab>
			<t:tab title="仪器设备" id="deviceTab" href="labTabController.do?deviceTab&centerId=${lab1.id}"></t:tab>
			<t:tab title="实验项目" id="projectTab" href="labTabController.do?projectTab&centerId=${lab1.id}"></t:tab>
			<t:tab title="实验场地" id="fieldTab" href="labTabController.do?expFieldTab&centerId=${lab1.id}"></t:tab> 
		</t:tabs>
	</t:formvalid>
</body>
    

    
 <script type="text/javascript">
 $(document).ready(function(){
 		//给时间控件加上样式
 		$("#buildDate").attr("class","Wdate").click(function(){WdatePicker({dateFmt:'yyyy-MM-dd'});});
 		moneyValidate('area');
 }); 
 
 function doBeforeSubmit(){
	 //插入新增员工信息
	 if(typeof staffList  != "undefined"){
		 for(var i =0;i<staffList.length;i++){
				if(staffList[i] == null ){
					continue;
				}
				
				var staff = staffList[i];
				var id = staff.id;
				createHiddenInput("staffId",staff.id);
				createHiddenInput("teacherId"+id,staff.teacherId);
				createHiddenInput("staffStart"+id,staff.start);
				createHiddenInput("staffEnd"+id,staff.end);
				createHiddenInput("staffWorkDetail"+id,staff.workDetail);
				createHiddenInput("positionNO"+id,staff.positionNO);
		} 
	 }
	 
	 if(typeof deleteStaffs  != "undefined"   ){
		 for(var i =0;i<deleteStaffs.length;i++){
			 createHiddenInput("deleteSaffId",deleteStaffs[i]);
		 }
	 }
	 
	 //插入新增设备信息
	 if(typeof deviceList != "undefined"  ){
		 for(var i =0;i<deviceList.length;i++){
				if(deviceList[i] == null ){
					continue;
				}
				
				var device = deviceList[i];
				var id = device.id;
				createHiddenInput("deviceId",device.id);
				createHiddenInput("deviceNo"+id,device.deviceNo);
				createHiddenInput("categoryNo"+id,device.categoryNo);
				createHiddenInput("name"+id,device.name);
				createHiddenInput("model"+id,device.model);
				createHiddenInput("spec"+id,device.spec);
				createHiddenInput("nation"+id,device.nation);
				createHiddenInput("buyDate"+id,device.buyDate);
				createHiddenInput("price"+id,device.price);
				
		} 
	 }
	 
	 if( typeof deleteDeviceList != 'undefined'){
		 for(var i =0;i<deleteDeviceList.length;i++){
			 createHiddenInput("deleteDeviceList",deleteDeviceList[i]);
		 }
	 }
	 
	 //插入新增项目信息
	 if(typeof projectList != "undefined"  ){
		 for(var i =0;i<projectList.length;i++){
				if(projectList[i] == null ){
					continue;
				}
				
				var project = projectList[i];
				var id = project.id;
				createHiddenInput("projectId",project.id);
				createHiddenInput("projectNO"+id,project.projectNO);
				createHiddenInput("projectName"+id,project.projectName);
				createHiddenInput("hour"+id,project.hour);
				createHiddenInput("groupPeopleCount"+id,project.groupPeopleCount); 
		} 
	 }
	 
	 if( typeof deleteprojectList != 'undefined'){
		 for(var i =0;i<deleteprojectList.length;i++){
			 createHiddenInput("deleteprojectList",deleteprojectList[i]);
		 }
	 }
	 
	 if(typeof fieldList != "undefined"  ){
		 for(var i =0;i<fieldList.length;i++){
				if(fieldList[i] == null ){
					continue;
				}
				
				var f = fieldList[i];
				var id = f.id;
				createHiddenInput("fieldId",id); 
		} 
	 }
	 
	 if( typeof deletefields != 'undefined'){
		 for(var i =0;i<deletefields.length;i++){
			 createHiddenInput("deletefields",deletefields[i]);
		 }
	 }
	 
 }
 
 function createHiddenInput(name,value){
	 $('#formobj').append("<input type='hidden' name='"+name+"' value='"+value+"' />");
 }
 </script>